package us.icitap.timsportal.resources;

import java.io.Serializable;
import java.util.Locale;
import java.util.ResourceBundle;

public class TimsPortalLabels implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1708636628229822530L;

	public static final String LABELS_PATH ="us.icitap.timsportal.resources.labels";
	
	private static ResourceBundle labels;
	
	private static void init() {

        labels = ResourceBundle.getBundle(LABELS_PATH, new Locale("sq", "AL"));
    }
	
	public static String getLabel(String key) {
        try {
           
           init();
            return labels.getString(key);
        }
        // on any failure we just return the key, which should aid in debugging.
        catch (Exception e) {
        	e.printStackTrace();
        	return key;
        }
    }
	
	public static String getLabel(Locale locale, String key) {
        try {
        	if (locale == null) {
                locale =new Locale("sq", "AL");
            }
        	labels = ResourceBundle.getBundle(LABELS_PATH, locale);
            return labels.getString(key);
        }
        // on any failure we just return the key, which should aid in debugging.
        catch (Exception e) {
            return key;
        }
    }
}
